<?php
if ($_SESSION["loggedin"]){
  if ($args[1]=="logout")
    User::GetUser()->Logout();
  header("Location: ?q=home");
}else if (isset($_POST["username"])){
    if (Util::HasValues($_POST, array("username", "password"), $p)){
    $remember = $_POST["remember"] == 'on';
    if (User::GetUser()->Login($p->username, $p->password, $remember)){
      header("Location: ?q=home");
    }
  }
  $error = "Invalid Credentials";
}
?>